﻿@using System.Diagnostics;
@using System.Collections;
@using System.Reflection;
@using System.Runtime.Versioning;
@using NewLife.Common;
@using NewLife.Cube.Extensions
@{
    Layout = NewLife.Cube.Setting.Current.Layout;

    ViewBag.Title = "进程模块";

    var isAll = String.Equals("All", Context.Request.GetRequestValue("Mode"), StringComparison.OrdinalIgnoreCase);

    var process = Process.GetCurrentProcess();
    var list = new List<ProcessModule>();
    foreach (ProcessModule item in process.Modules)
    {
        if (isAll || item.FileVersionInfo.CompanyName != "Microsoft Corporation") { list.Add(item); }
    }
}
<table class="table table-bordered table-hover table-striped table-condensed">
    <tr>
        <th colspan="7">
            进程模块(@process.ProcessName , PID=@process.Id )
            @if (!isAll)
                {
                <text>（<a href="?Mode=All">完整</a>，仅用户）：</text>
                }
                else
                {
                <text>（完整，<a href="?Mode=OnlyUser">仅用户</a>）：</text>
                }
        </th>
    </tr>
    <tr>
        <th>
            模块名称
        </th>
        <th>
            公司名称
        </th>
        <th>
            产品名称
        </th>
        <th>
            描述
        </th>
        <th>
            版本
        </th>
        <th>
            大小
        </th>
        <th>
            路径
        </th>
    </tr>
    @foreach (ProcessModule item in list)
    {
        <tr>
            <td>
                @item.ModuleName
            </td>
            <td>
                @item.FileVersionInfo.CompanyName
            </td>
            <td>
                @item.FileVersionInfo.ProductName
            </td>
            <td>
                @item.FileVersionInfo.FileDescription
            </td>
            <td>
                @item.FileVersionInfo.FileVersion
            </td>
            <td>
                @item.ModuleMemorySize
            </td>
            <td>
                @item.FileName
            </td>
        </tr>
    }
</table>